package towerDefense.units.qualities;

import util.qualitycontainers.qualities.IMorphQuality;
import com.golden.gamedev.object.Sprite;
import com.golden.gamedev.object.sprite.AdvanceSprite;


@SuppressWarnings("serial")
public class SpriteQ extends AdvanceSprite implements IMorphQuality
{

    /**
     * Compares by SpriteID
     */
    @Override
    public int compareTo (IMorphQuality o)
    {
        return ((Integer) this.getID()).compareTo(((SpriteQ) o).getID());
    }


    @Override
    public void setTo (IMorphQuality q)
    {
        Sprite o = (AdvanceSprite) q;

        this.setActive(o.isActive());
        this.setBackground(o.getBackground());
        this.setID(o.getID());
        this.setHorizontalSpeed(o.getHorizontalSpeed());
        this.setImage(o.getImage());
        this.setImmutable(o.isImmutable());
        this.setX(o.getX());
        this.setY(o.getY());
        this.setVerticalSpeed(o.getVerticalSpeed());
    }


    @Override
    public boolean isSameQualityClass (IMorphQuality other)
    {
        return isSameQualityClass(other.getClass());
    }


    @Override
    public boolean isSameQualityClass (Class<? extends IMorphQuality> cls)
    {
        return this.getAnimationFrame().equals(cls);
    }


    @Override
    public boolean equals (IMorphQuality q)
    {
        return ((Integer) this.getID()).equals(((SpriteQ) q).getID());

    }

}
